package com.sky.mapper;

import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserAddressMapper {

    void addAddress(AddressBook addressBook);

    List<AddressBook> selectAllData();

    List<AddressBook> selectDefaultData();

    void updateAddress(AddressBook addressBook);

    AddressBook selectAddressInfoById(Long id);

    void deleteAddressById(Long id);

    @Update("update address_book set is_default = 0 where is_default = 1")
    void updateAddressNODefault();

    @Update("update address_book set is_default = 1 where id = #{id}")
    void updateAddressMyDefault(Long id);
}
